home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #2 / Ham Radio 2000 - Volume 2.iso / HAMV2 / TCP_IP / TNOS230S / SMTP.H < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-24  |  2.9 KB  |  111 lines

  1. #ifndef    _SMTP_H
  2. #define    _SMTP_H
  3.  
  4. #define SMTPTRACE            /* enable tracing for smtp */
  5. #define MAXSESSIONS    10        /* most connections allowed */
  6. #define JOBNAME        13        /* max size of a job name with null */
  7. #undef  LINELEN
  8. #define    LINELEN        256
  9. #define PLINELEN    256
  10. #define RLINELEN    512
  11. #define TLINELEN    1024
  12. #undef  SLINELEN
  13. #define SLINELEN    64
  14. #define MBOXLEN        8        /* max size of a mail box name */
  15.  
  16. /* types of address used by smtp in an address list */
  17. #define BADADDR        0
  18. #define LOCAL        1
  19. #define DOMAIN        2
  20. #define NNTP_GATE    3
  21.  
  22. /* a list entry */
  23. struct list {
  24.     struct list *next;
  25.     char *val;
  26.     char *orig;
  27.     char type;
  28. };
  29.  
  30. /* Per-session control block  used by smtp server */
  31. struct smtpsv {
  32.     int s;            /* the socket for this connection */
  33.     char *system;        /* Name of remote system */
  34.     char *from;        /* sender address */
  35.     char *sender;        /* actual original sender */
  36.     struct list *to;    /* Linked list of recipients */
  37.     char *bid;        /* BID if any */
  38.     int dupbid;        /* indicates a duplicate bid */
  39. #ifdef TRANSLATE
  40.     int translated;
  41. #endif
  42.     FILE *data;        /* Temporary input file pointer */
  43. };
  44.  
  45. /* used by smtpcli as a queue entry for a single message */
  46. struct smtp_job {
  47.     struct     smtp_job *next;    /* pointer to next mail job for this system */
  48.     char    jobname[9];    /* the prefix of the job file name */
  49. #if 0
  50.     long    len;        /* length of file */
  51. #endif
  52.     char    *from;        /* address of sender */
  53.     struct list *to;    /* Linked list of recipients */
  54. };
  55.  
  56. /* control structure used by an smtp client session */
  57. struct smtpcli {
  58.     int     s;        /* connection socket */
  59.     uint32    ipdest;        /* address of forwarding system */
  60.     char    *destname;    /* domain address of forwarding system */
  61.     char    *wname;        /* name of workfile */
  62.     char    *tname;        /* name of data file */
  63.     char    buf[LINELEN];    /* Output buffer */
  64. #if 0
  65.     char    cnt;        /* Length of input buffer */
  66. #endif
  67.     FILE    *tfile;
  68.     struct    smtp_job *jobq;
  69.     struct    list     *errlog;    
  70.     int lock;        /* In use */
  71. };
  72.  
  73. /* smtp server routing mode */
  74. #define    QUEUE    1
  75.  
  76. #define    NULLLIST    (struct list *)0
  77. #define    NULLSMTPSV    (struct smtpsv *)0
  78. #define    NULLSMTPCLI    (struct smtpcli *)0
  79. #define NULLJOB        (struct smtp_job *)0
  80.  
  81. extern int Smtpmode;
  82. #ifndef _FILES_H
  83. #include "files.h"
  84. #endif
  85.  
  86. /* In smtpserv.c: */
  87. #ifndef _COMMANDS_H
  88. char *ptime (time_t *t);
  89. #endif
  90. long get_msgid (int);
  91. #ifndef _MAILUTIL_H
  92. char *getname (char *cp);
  93. #endif
  94. int validate_address (const char *s);
  95. int queuejob (FILE *dfile,char *host,struct list *to,const char *from);
  96. struct list *addlist (struct list **head,const char *val,int type,const char *orig);
  97. int mdaemon (FILE *data,const char *to,struct list *lp,int bounce);
  98.  
  99. /* In smtpcli.c: */
  100. void smtptick (void *t);
  101. #ifndef _MAILUTIL_H
  102. int mlock (const char *thedir,char *id);
  103. void rmlock (const char *thedir,char *id);
  104. #endif
  105. void del_list (struct list *lp);
  106. uint32 mailroute (char *dest);
  107. extern const char *Months[];
  108.  
  109. #endif    /* _SMTP_H */
  110.  
  111.